<?php
//设置网页编码
header('Content-type:text/html;charset=utf-8');
//包含网站配置文件
include '../public/wzconfig.php';
//包含数据库配置文件
include '../public/dbconfig.php';
//包含函数库文件
include '../public/functions.php';
//调用函数 链接数据库
$link = con();

//接收用户要搜索的内容
$title = $_POST['title'];
?>
<link rel="stylesheet" type="text/css" href="./css/list.css">
<div id="list">
	<div class="list_top1">
		<div class="list_top2">帖子标题</div>
		<div class="list_top3">作者</div>
		<div class="list_top4">回复/查看</div>
		<div class="list_top5">最后发表</div>
	</div>
	
	<div class="list_content">
<?php
//准备搜索语句
$sql = "select f.id,f.title,u.username,f.rtime from ftiezi f,user u where title like '%{$title}%' and f.uid=u.id";

//执行sql
$res = mysqli_query($link, $sql);
//判断执行结果
if($res && mysqli_num_rows($res)){
	while($tinfo = mysqli_fetch_assoc($res)){
?>
		<div class="list_content_1">
			<div class="list_top2"><a href="detail.php?tid=<?php echo $tinfo['id']?>&cid=<?php echo $cid?>"><?php echo $tinfo['title']?></a></div>
			<div class="list_top3"><?php echo $tinfo['username']?></div>
			<div class="list_top4">10/20</div>
			<div class="list_top5"><span style="color:red;"><?php echo time()-($tinfo['rtime'])?></span>秒前</div>
		</div>
<?php
	}
}
?>
	</div>
</div>
<div class="clear"></div>
<div style="width:960px;margin:0 auto;"><a href="index.php">回到首页</a></div>